from pythonds.basic.queue import Queue


def hotPotato(namelist, num):
    simqueue = Queue()
    for name in namelist:
        print(name)
        simqueue.enqueue(name)
    while simqueue.size() > 1:
        for i in range(num):
            simqueue.enqueue(simqueue.dequeue())  # 传递一次，出来后到队列尾
        simqueue.dequeue()  # 移除之后的队首那一个
    return simqueue.dequeue()  # 返回剩余的最后一个


print(hotPotato(['Bill', 'David', 'Susan', 'Jane', 'Kent', 'Brad'], 6))
